﻿@model IEnumerable<RecentCommentViewModel>

@{
	Layout = null;
}

@if (Model.Any())
{
	<ul class="unstyled">
		@foreach (var comment in Model)
		{
			<li>
				<h4>
					@Html.RouteLink(Html.Substring(comment.PostTitle, 50), "PostDetails", null, null, string.Format("comment-{0}", comment.CommentId), new
																																						   {
																																							   id = comment.PostId,
																																							   slug = comment.PostSlug
																																						   }, null)
				</h4>

				<p class="recent-comments-body">
					@Html.Substring(comment.Body, 200)
				</p>
				
				<p>
					@Html.Link(comment.Author, comment.Url, new
																{
																	target = "_blank"
																}) - @comment.CreatedAt.ToReadableOffset(DateTime.UtcNow) 
				</p>
				
				@if (comment != Model.Last())
				{
					<hr />
				}
			</li>
		}
	</ul>
}
else
{
	<p>No recent comments.</p>
}